package com.smit.common;

/**
 * 保存服务器访问地址
 */
public final class HttpUrl {
    /** 设备鉴权接口 */
    public static final int DEVICE_AUTH = 1;
    /** DVB 插件下载 */
    public static final int DVB_PLUGIN = 2;
    /** Dongle 固件下载 */
    public static final int DONGLE_FIRMWARE_UPDATE = 3;

    private static final String RONGHE_OTT_URL = "http://www.ronghe.tv/ottrep/webservice/epg/";
    private static final String RONGHE_OTT_TEST_URL = "http://182.50.1.241/ottrep/webservice/epg/";
    private static boolean isWebTest = false;
    private static final String TAG = "HttpUrl";
    private static String[] serviceList = {
            "epg_DeviceAuth.php", //1
            "dvb_dvbplugin.php", //2
            "epg_DeviceUpgrate.php", //3 shit,哪个小学生定的接口
    };
    private HttpUrl() { }

    /**
     * 获取服务器访问url
     * @param type 接口类型
     * @return url地址
     */
    public static String getUrl(int type) {
        if (isWebTest) {
            return getTestUrl(type);
        }
        if (type < 1 || type > serviceList.length) {
            return null;
        }
        else {
            return RONGHE_OTT_URL + serviceList[type - 1];
        }
    }

    private static String getTestUrl(int type) {
        if (type < 1 || type > serviceList.length) {
            return null;
        }
        else {
            return RONGHE_OTT_TEST_URL + serviceList[type - 1];
        }
    }

}